package vue;

import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import data.Bd;

public class Menu extends JFrame {
    
    /**
	 * Frame ID
	 */
	private static final long serialVersionUID = 1L;

	/**
     * BD
     */
    Bd bd = new Bd();

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Menu frame = new Menu();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Menu() {
		setTitle("Manga");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 445, 218);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton btnGererLesGenres = new JButton("Gérer les genres");
		btnGererLesGenres.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
		        new DepotSimpleFrm(bd.getGenres()).afficher();
			}
		});
		btnGererLesGenres.setBounds(231, 82, 200, 25);
		contentPane.add(btnGererLesGenres);
		
		JButton btnGererLesAuteurs = new JButton("Gérer les auteurs");
		btnGererLesAuteurs.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
		        new DepotSimpleFrm(bd.getAuteurs()).afficher();
			}
		});
		btnGererLesAuteurs.setBounds(231, 12, 200, 25);
		contentPane.add(btnGererLesAuteurs);
		
		JButton btnGererLesEditeurs = new JButton("Gérer les éditeurs");
		btnGererLesEditeurs.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
		        new DepotSimpleFrm(bd.getEditeurs()).afficher();
			}
		});
		btnGererLesEditeurs.setBounds(231, 47, 200, 25);
		contentPane.add(btnGererLesEditeurs);
		
		JButton btnGererLesTypes = new JButton("Gérer les types");
		btnGererLesTypes.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
		        new DepotSimpleFrm(bd.getTypes()).afficher();
			}
		});
		btnGererLesTypes.setBounds(231, 117, 200, 25);
		contentPane.add(btnGererLesTypes);
		
		JButton btnGererLesPays = new JButton("Gérer les pays");
		btnGererLesPays.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
		        new DepotSimpleFrm(bd.getPays()).afficher();
			}
		});
		btnGererLesPays.setBounds(231, 152, 200, 25);
		contentPane.add(btnGererLesPays);
		
		JButton btnGererLesPersonnes = new JButton("Gérer les emprunteurs");
		btnGererLesPersonnes.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
		        new DepotSimpleFrm(bd.getPersonnes()).afficher();
			}
		});
		btnGererLesPersonnes.setBounds(19, 152, 200, 25);
		contentPane.add(btnGererLesPersonnes);
		
		JButton btnSeries = new JButton("Gérer les séries");
		btnSeries.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
		        new DepotSerieFrm(bd).afficher();
			}
		});
		btnSeries.setBounds(19, 12, 200, 25);
		contentPane.add(btnSeries);
	}
}
